package com.itheima.web;

import com.itheima.service.SetmealService;
import com.itheima.support.Result;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/setmeal")
public class SetmealController {

    @DubboReference
    private SetmealService setmealService;

    @GetMapping("/findAll")
    public Result findAll(){
        return new Result(setmealService.list());
    }

    @GetMapping("/findById/{id}")
    public Result findById(@PathVariable("id") Long setmealId){
        return new Result(setmealService.findById(setmealId));
    }

}
